package cn.edu.fzu.delivery.controller.sys;

import cn.edu.fzu.delivery.common.Result;
import cn.edu.fzu.delivery.domain.entity.City;
import cn.edu.fzu.delivery.service.CityService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author yifan
 * @date 2022/11/7
 */
@RestController
@RequestMapping("/api/sys/city")
@Api(tags = "城市管理")
public class CityController {
    @Resource
    private CityService cityService;

    @GetMapping("/list")
    @ApiOperation(value = "获取城市列表", httpMethod = "GET")
    @ApiImplicitParam(name = "provinceId", value = "所属省份id")
    public Result list(Long provinceId) {
        List<City> cities = cityService.list(provinceId);
        return new Result(cities);
    }
}
